package com.qf.function;

import com.qf.function.pojo.User;

import java.util.function.Function;

/*
 *@Description:
 *@author:刘哥
 *@Date:86180 2022/9/2 14:54
 */
public class FunctionTest {
    public static void main(String[] args) {
//        第一个参数参数，第二个参数是结果的类型
//        Function<String,User > function=new Function<String, User>() {
//            @Override
//            public User apply(String s) {
//                User user=new User();
//                user.setName(s);
//                return user;
//            }
//        };

        Function<String,User> function=name->{
            User user=new User();
            user.setName(name);
            return user;
        };
        User user = function.apply("张三");
        System.out.println("user = " + user);
    }
}
